﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PMS.Data.DbUtils.DataMapping;
using PMS.Data.Entities.Medias;

namespace PMS.Data.EntityMap.Medias
{
    /// <summary>
    /// Represents a MimeType mapping configuration
    /// </summary>
    public partial class MediaFileMap : PMSEntityTypeConfiguration<MediaFile>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<MediaFile> builder)
        {
            builder.ToTable("bus_media");
            builder.HasKey(media => media.Id);

            builder.Property(media => media.SeoFilename).HasMaxLength(128).IsRequired();
            builder.Property(media => media.ExtensionName).HasMaxLength(32).IsRequired();
            builder.Property(media => media.Useage).HasMaxLength(32).IsRequired();
            builder.Property(media => media.Title).HasMaxLength(128);
            builder.Property(media => media.Description).HasMaxLength(200);
            builder.Property(media => media.ImageLink).HasMaxLength(1024);
            builder.Property(media => media.VirtualPath).HasMaxLength(1024).IsRequired();
            builder.Ignore(media => media.IsActive);
            builder.Property(media => media.CreatedOnTimeUtc).IsRequired();
            builder.Property(media => media.UpdatedOnTimeUtc).IsRequired();
            base.Configure(builder);
        }

        #endregion
    }
}
